<!-- Statistics! -->
<div class="row">
  <div id="aflkj" class="col-sm-6">
    <p>Provider Information:</p>
    <p>
      <% @providers.sort_by{|k,v| v.count }.reverse.each do |k,v| %>
        <%= v.count %>: <a href="/<%=@project_name%>/entities?search_string=<%=k%>"><%= k %></a><br>
      <% end %>
    </p>
  </div>
  <div id="aflkj" class="col-sm-6">
    <p>OS Information:</p>
    <p>
      <% @os.sort_by{|k,v| v.count }.reverse.each do |k,v| %>
         <%= v.count %>: <a href="/<%=@project_name%>/entities?search_string=<%=k%>"><%= k %></a><br>
      <% end %>
    </p>
  </div>
</div>
<div class="row">
  <div id="aflkj" class="col-sm-12">
    <script type="text/javascript" src="/js/sorttable.js"></script>
    <style>
    /* Sortable tables */
    table.sortable {
      width: 100%;
      border: 0;
      table-layout:fixed;
      word-wrap:break-word;
      border-collapse:collapse;
    }

    table.sortable thead {
        background-color:#eee;
        color:#666666;
        font-weight: bold;
        cursor: default;
    }
    </style>
    <p></p>
    <table class="sortable" border="1" width=100%>
      <colgroup>
        <col style="width:20%">
        <col style="width:20%">
        <col style="width:20%">
        <col style="width:20%">
        <col style="width:20%">
      </colgroup>
      <tbody>
      <tr><th>Ip Address</th><th>Aliases</th><th>OS</th><th>Ports</th><th>Provider</th></tr>
      <% @entities.each do |x| %>
        <tr>
          <% next unless x.type_string == "IpAddress" %>
          <td><a href="<%="/#{h @project_name}/entities/#{h x.id}"%>"><%= h x.name %></a></td>
          <td><%= (x.aliases - [x.name]).map{|x| "<a href='/#{@project_name}/entities/#{h x.id}'>#{h x.name}</a>" }.join("<br/>") %></td>
          <td><%= h x.details["os"].first if x.details["os"] %> </td>
          <td><%= h "#{x.details["ports"].map{ |x| x["number"] }.join(", ") if x.details["ports"]}" %></td>
          <td><%= h "#{x.details["provider"]}"%></td>
        </tr>
      <% end %>
      </tbody>
    </table>
  </div>
</div>
